package net.sareweb.acab.session;

import net.sareweb.acab.entity.*;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.framework.EntityQuery;
import java.util.Arrays;

@Name("stateList")
public class StateList extends EntityQuery<State> {

	private static final String EJBQL = "select state from State state";

	private static final String[] RESTRICTIONS = {
			"lower(state.name) like lower(concat(#{stateList.state.name},'%'))",
			"lower(state.code) like lower(concat(#{stateList.state.code},'%'))", };

	private State state = new State();

	public StateList() {
		setEjbql(EJBQL);
		setRestrictionExpressionStrings(Arrays.asList(RESTRICTIONS));
		setMaxResults(25);
	}

	public State getState() {
		return state;
	}
}
